﻿import com.dmotiko.bolacua.*
import com.dmotiko.general.*
import mx.utils.Delegate;

class LanguageSensible
extends BaseClip {
	
	private function initClip():Void {
		super.initClip();
		BolacuaSite.getApp().addEventListener( WebSite.LANGUAGE_CHANGED, Delegate.create(this, lang_changed) );
		var mcDummy = createEmptyMovieClip("mcDummy", getNextHighestDepth() );
		mcDummy.onEnterFrame = function(){
			_parent.lang_changed( { value: BolacuaSite.getApp().getLanguage() } );
			this.removeMovieClip();
		}
	}
	
	/**
	 * @author sminutoli
	 * @usage for override purposes
	 * @param e
	 */
	private function lang_changed(e):Void {
		BolacuaSite.getApp().log( "LanguageSensible | lang_changed = " + e.value );
		if ( e.value == BolacuaSite.SPANISH) {
			showSpanish();
		} else {
			showEnglish();
		}
	}
	
	private function showEnglish():Void {
		gotoAndStop(2); //override if you need
	}
	
	private function showSpanish():Void {
		gotoAndStop(1); //override if you need
	}
	
}